import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProClientMaintainVO, ProClientMaintainForm, ProClientMaintainQuery } from '@/api/project/client/maintain/types';

/**
 * 查询客户维护列表
 * @param query
 * @returns {*}
 */

export const listProClientMaintain = (query?: ProClientMaintainQuery): AxiosPromise<ProClientMaintainVO[]> => {
  return request({
    url: '/pro/client/maintain/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询客户维护详细
 * @param id
 */
export const getProClientMaintain = (id: string | number): AxiosPromise<ProClientMaintainVO> => {
  return request({
    url: '/pro/client/maintain/' + id,
    method: 'get'
  });
};

/**
 * 新增客户维护
 * @param data
 */
export const addProClientMaintain = (data: ProClientMaintainForm) => {
  return request({
    url: '/pro/client/maintain',
    method: 'post',
    data: data
  });
};

/**
 * 修改客户维护
 * @param data
 */
export const updateProClientMaintain = (data: ProClientMaintainForm) => {
  return request({
    url: '/pro/client/maintain',
    method: 'put',
    data: data
  });
};

/**
 * 删除客户维护
 * @param id
 */
export const delProClientMaintain = (id: string | number | Array<string | number>) => {
  return request({
    url: '/pro/client/maintain/' + id,
    method: 'delete'
  });
};
